<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>
    <div>index2：写ls</div>
    <p></p>
    <script>
        document.querySelector('div').addEventListener('click', function () {
            // document.querySelector('p').innerHTML = localStorage.getItem('task');
            var storage = window.localStorage;
            //写入a字段
            storage["a"] = 1;
            //写入b字段
            storage.b = 2;
            //写入c字段
            storage.setItem("c", 3);
        }, false);
    </script>
</body>

</html>